package com.tuanzi.loan.business.service.push;

import com.tuanzi.loan.business.constants.push.LoanPushMessageSendTaskStatus;
import com.tuanzi.loan.business.entity.push.LoanPushMessageSendTask;
import com.tuanzi.loan.core.service.CommonService;
import com.tuanzi.loan.core.vo.PageSearcher;
import com.tuanzi.loan.vo.request.family.push.LoanPushMessageSendTaskRequest;
import com.tuanzi.loan.vo.response.family.push.LoanPushMessageSendTaskResponse;
import org.springframework.data.domain.Page;

import java.util.Date;

/**
 * @Author: chenweijun
 * @Date: 2018/12/12 14:33
 * @Description:
 */
public interface LoanPushMessageSendTaskService extends CommonService<LoanPushMessageSendTask, Long>{

    /**
     * 查询发送任务列表
     * @param pageSearcher
     * @return
     */
    Page<LoanPushMessageSendTaskResponse> list(PageSearcher<LoanPushMessageSendTaskRequest> pageSearcher);


    Long countByStatus(LoanPushMessageSendTaskStatus status);


    LoanPushMessageSendTask findTopByStatusAndSendTimeBefore(LoanPushMessageSendTaskStatus status, Date sendTime);


    void updateStatusWithoutTransactional(LoanPushMessageSendTask sendTask, LoanPushMessageSendTaskStatus status);

    void cancelTask(Long id);

    void onResend(Long id);

    /**
     * 发送推送消息
     */
    public void sendPushMessage(LoanPushMessageSendTask sendTask);


}
